function stripHtmlTags(s,max){
s=s.replace(/<br.*?>/ig, ' ');
return s.replace(/<.*?>/ig, '').split(/\s+/).slice(0,max-1).join(' ')
}
function showrecentposts(json) {

	img  = new Array();
    if (numposts <= json.feed.entry.length) {
		maxpost = numposts;
		}
	else
       {
	   maxpost=json.feed.entry.length;
	   }
var slidermain = '<div class="main-slider"><ul class="sliders-wrap-inner">';
var slidernavi = '<div class="navigator-content"><div class="navigator-wrapper"><ul class="navigator-wrap-inner">';	   
	   
for (var i = 0; i < maxpost; i++) {
	var entry = json.feed.entry[i];
	var posttitle = entry.title.$t;
	var pcm ;
	var posturl;
	if("media$thumbnail" in entry){
	var thumburl = entry.media$thumbnail.url;
	}
	else{ var thumburl = "http://bit.ly/hGWr7r"};
	
	if (i == json.feed.entry.length) break;
	for (var k = 0; k < entry.link.length; k++) {
		if (entry.link[k].rel == 'alternate') {
		posturl = entry.link[k].href;
			break;
		}
	}	
	var authpost = entry.author[0].name.$t;
	var postdate = entry.published.$t;
	var month = [1,2,3,4,5,6,7,8,9,10,11,12];
	var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
	var day = postdate.split("-")[2].substring(0,2);
	var m = postdate.split("-")[1];
	var y = postdate.split("-")[0];
	postDay = day+ "/" + m + "/" + y ;
	if ("content" in entry) {
		var postcontent = entry.content.$t;}
	else if ("summary" in entry) {
		var postcontent = entry.summary.$t;}
	else postcontent = "";
	
	s = postcontent; a = s.indexOf("<img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5);
			if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")) {img[i] = d;}
	else {img[i]="http://bit.ly/hGWr7r";}

	slidermain += '<li><img onclick="javascript: location.href = \''+posturl+'\'; " title="'+posttitle+'" alt="'+posttitle+'" src="'+img[i]+'"/><div class="slider-description"><h2><a href="'+posturl+'" title="'+posttitle+'" rel="'+posttitle+'">'+posttitle+'</a></h2> '+stripHtmlTags(postcontent,summaryposts)+'...</div></li>' ;	
	slidernavi += '<li><div><img alt="'+posttitle+'" src="'+img[i]+'" /> <h2> '+posttitle+'</h2></div></li>';	
	
	} 
slidermain += "</ul></div>";
slidernavi += "</ul></div></div>";
document.write(slidermain+slidernavi);
}	
document.write("<script src=\""+home_page+"feeds/posts/default/-/"+label+"?max-results="+numposts+"&orderby=published&alt=json-in-script&callback=showrecentposts\"><\/script>");
document.write("<div class='preload'><div></div></div>");
document.write("<div  class='button-previous'>Previous</div>");
document.write("<div class='button-next'>Next</div>");
document.write(" <div class='button-control'><span></span></div>");